package shop.yaojianfeng.springlearning.section4.controller;

import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import shop.yaojianfeng.springlearning.section4.entity.StudentInfo20;
import shop.yaojianfeng.springlearning.section4.service.StudentInfo20Service;

import javax.annotation.Resource;

/**
 * 200720班同学基本信息(StudentInfo20)表控制层
 *
 * @author
 * @since 2022-04-14 10:47:11
 */
@Controller
@RequestMapping("/studentInfo20")
public class StudentInfo20Controller {
    /**
     * 服务对象
     */
    @Resource(name = "studentInfo20Service")
    private StudentInfo20Service studentInfo20Service;


    @RequestMapping("/queryCount")
    @ResponseBody
    public int queryCount() {
        return studentInfo20Service.queryCount();
    }

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @RequestMapping("/queryById")
    public String queryById(String studentId, Model model) {
        model.addAttribute("student", studentInfo20Service.queryById(studentId));
        return "studentInfo20";
    }

    @RequestMapping("/queryOne")
    public String queryOne(StudentInfo20 studentInfo20, Model model) {
        StudentInfo20 studentInfo201 = studentInfo20Service.queryOne(studentInfo20);
        model.addAttribute("student", studentInfo201);
        return "studentInfo20";
    }


}

